Skip to content

feat(ev-dev): part 5 – add interactive TUI dashboard#184

Open
randygrok wants to merge 20 commits intoev-deployer-part4-ev-dev-integrationfrom
feat/ev-dev-part5-tui
Open

feat(ev-dev): part 5 – add interactive TUI dashboard#184
randygrok wants to merge 20 commits intoev-deployer-part4-ev-dev-integrationfrom
feat/ev-dev-part5-tui

Conversation

@randygrok
Copy link
Copy Markdown
Contributor

Description

Adds an interactive terminal UI dashboard to ev-dev with the --tui flag. The TUI displays real-time blocks, logs, and accounts panels using ratatui, with a custom tracing layer that captures log events in real-time. Plain log output remains the default behavior.

Type of Change

  • New feature (non-breaking change which adds functionality)

Testing

  • TUI renders blocks, logs, and accounts panels
  • Keyboard navigation works (Tab, arrows, q to quit)
  • Terminal properly restored on exit or panic
  • Plain log output mode (--tui off) unchanged

- Integrate ratatui for terminal UI with blocks, logs, and accounts panels
- Implement custom tracing layer to capture real-time log events
- Add keyboard navigation (Tab for panel switch, arrows for scroll, q to quit)
- Support coexistence of TUI and plain log output modes
- Add crossterm for terminal event handling
@randygrok randygrok requested a review from a team as a code owner March 20, 2026 08:33
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 20, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d6929a21-50fe-4f11-a046-6a57f4d0f690

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/ev-dev-part5-tui

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@claude
Copy link
Copy Markdown

claude bot commented Mar 20, 2026

Claude finished @randygrok's task —— View job


PR Review: Interactive TUI Dashboard

I've completed a comprehensive review of this PR. The TUI implementation is well-structured and follows good practices overall. Here are my findings:

Strengths

Architecture & Design:

  • Clean separation of concerns with dedicated modules (app.rs, ui.rs, tracing_layer.rs, events.rs)
  • Well-designed state management in App struct with clear separation of static vs dynamic data
  • Proper use of channels for async communication between components
  • Good terminal handling with TerminalGuard for cleanup and panic hook restoration

Code Quality:

  • Consistent error handling patterns using eyre::Result
  • Proper resource management with RAII patterns
  • Good use of const functions where appropriate
  • Clear naming conventions and module structure

User Experience:

  • Intuitive keyboard navigation (Tab, arrows, q to quit)
  • Visual feedback for clipboard operations with 2-second flash messages
  • Proper panel focus indication and selection states
  • Real-time updates for blocks, logs, and account balances

⚠️ Areas for Improvement

Error Handling & Robustness:

  1. Silent RPC failures: In spawn_balance_poller (lines 343-346), network errors are silently converted to "? ETH" without logging
  2. Potential panic in parsing: chain_id_from_genesis() (lines 94-96) uses .expect() which could panic on malformed genesis
  3. Unchecked channel sends: TuiTracingLayer::on_event (line 81) uses try_send but ignores failures

Performance Considerations:

  1. Fixed polling interval: Balance poller uses hardcoded 2-second interval regardless of network conditions
  2. Unbounded log storage: While capped at 1000 entries, rapid logging could cause memory spikes
  3. RPC connection recreation: New provider instance created on every balance check instead of reusing connections

Security & Dependencies:

  1. Clipboard access: Uses arboard crate for clipboard operations - ensure this is necessary for CLI tool
  2. Private key handling: Keys are stored in memory as strings and copied to clipboard (acceptable for dev tool but worth noting)

Code Maintainability:

  1. Magic numbers: Several hardcoded values (MAX_LOGS: 1000, MAX_BLOCKS: 200, polling intervals) should be configurable
  2. String truncation logic: Duplicated hex truncation logic in multiple places
  3. Missing documentation: Public functions lack doc comments

🔍 Specific Issues Found

In app.rs:

  • Line 246: RPC URL parsing with .expect() - should handle gracefully
  • Lines 343-346: Silent error handling in balance fetcher could mask network issues
  • Line 314: Potential precision loss in ether formatting for very large values

In main.rs:

  • Lines 94-96: Panic-prone genesis parsing without graceful degradation
  • Line 322: Tracing layer setup before CLI parsing could interfere with reth's own tracing

In tracing_layer.rs:

  • Line 81: Dropped log events when channel is full - no backpressure handling

🚨 Missing Test Coverage

The PR adds significant functionality but no tests are included. Critical areas needing test coverage:

  • Log parsing and field extraction logic
  • Balance formatting functions (format_ether, format_gas)
  • Key event handling in different states
  • Error scenarios (network failures, malformed data)
  • Terminal restoration under various exit conditions

📝 Recommendations

  1. Add comprehensive tests, especially for:

    • format_ether function with edge cases
    • Block parsing from log fields
    • Key event handling state machine
  2. Improve error handling:

    // Instead of silent failures in balance poller
    Err(e) => {
        tracing::warn!("Failed to fetch balance for {addr}: {e}");
        balances.push("? ETH".to_string())
    }
  3. Make configuration more flexible:

    • Add CLI flags for polling intervals
    • Make log/block limits configurable
    • Consider connection pooling for RPC calls
  4. Add proper logging: Use the tracing system to log important events and errors instead of silent failures

🏁 Overall Assessment

This is a solid implementation that successfully adds TUI functionality to ev-dev. The code is well-organized, follows Rust best practices, and provides a good user experience. The main concerns are around error handling resilience and missing test coverage, but these don't block functionality.

Recommendation: Approve with suggested improvements - The TUI feature works as designed and enhances the developer experience significantly.


@randygrok randygrok changed the title feat(ev-dev): add interactive TUI dashboard feat(ev-dev): part 5 – add interactive TUI dashboard Mar 20, 2026
@randygrok randygrok marked this pull request as draft March 20, 2026 14:33
@randygrok randygrok marked this pull request as ready for review March 25, 2026 10:07
Add Nick's CREATE2 factory (0x4e59b44...956c) to the devnet genesis
so that ev-deployer deploy works against ev-dev out of the box.

On post-merge chains the canonical keyless deployment transaction
cannot be replayed, so the runtime bytecode is embedded directly
in the genesis alloc.

Document the live deployment workflow in both ev-dev and ev-deployer
READMEs.
…dy:evstack/ev-reth into feat/ev-dev-part5-tui

# Conflicts:
#	bin/ev-deployer/src/deploy/pipeline.rs
#	bin/ev-deployer/src/init.rs
Deploy mode now uses the original Uniswap salt so Permit2 lands at its
canonical address (0x000000000022D473030F116dDEE9F6B43aC78BA3) instead
of a random one.
`ev-deployer init genesis` generates config with address fields for
genesis injection. `ev-deployer init deploy` generates config without
addresses (computed via CREATE2) and auto-includes the deterministic
deployer since it is required for deploy mode.
…late

The deterministic deployer cannot be deployed via CREATE2 (circular
dependency). The deploy pipeline already verifies it exists on-chain,
so including it in the deploy config template was misleading.
Reflect the init genesis/deploy split, canonical Permit2 CREATE2 salt,
and removal of deterministic deployer from deploy config.
The flag passes a config for embedding contracts into genesis, not for
deploying to a live chain. The old name was misleading after the init
genesis/deploy split.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants